package com.hanj.gulimall.member.controller;

import com.hanj.common.utils.R;
import com.hanj.gulimall.member.entity.MemberEntity;
import com.hanj.gulimall.member.feignService.CouponFeignTest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author hanj.cn@outlook.com
 */
@RestController
@RequestMapping("/member/test")
public class TestController {

    @Resource
    private CouponFeignTest couponFeignTest;

    @RequestMapping("/feignConnectTest")
    public R feignConnectTest() {

        MemberEntity memberEntity = new MemberEntity();
        memberEntity.setNickname("hanj");
        R r = couponFeignTest.feignConnectTest();
        // 通过feign远程调用coupon微服务的查询接口获取会员hanj所拥有的优惠券
        return R.ok().put("member", memberEntity).put("coupons", r.get("coupons"));

    }

}
